package com.bookstore.client.cart.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bookstore.client.cart.dao.ICartDao;
import com.bookstore.client.cart.service.ICartService;
import com.bookstore.commons.beans.Order;
import com.bookstore.commons.beans.OrderItem;

@Service
public class CartServiceImpl implements ICartService {
	
	@Autowired
	private ICartDao cartDao;
	
	
	@Override
	@Transactional
	public void addOrderItem(OrderItem item) {
			cartDao.insertOrderItem(item);
			cartDao.updateProduct(item);
	}

	@Override
	public void createOrder(Order order) {
			cartDao.insertOrder(order);

	}

	@Override
	public void paySuccess(String out_trade_no) {
		cartDao.updateOrderPaystate(out_trade_no);
	}

}
